<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="4.jsp">
请输入一个1~9的数：<input type="text" name="number">
<button type="submit">提交</button>
</form>

<%
	List<String> num=new ArrayList<String>();
	int i;
	String number= request.getParameter("number");
	if(number==null)
		number="1";
	int n=Integer.parseInt(number);
	int sum;
	for(i=1;i<=9;i++)
	{
		sum=n*i;
		num.add(n+"*"+i+"="+sum);
	}
	pageContext.setAttribute("num", num);
%>
${num[0]}<br>${num[1]}<br>${num[2]}<br>${num[3]}<br>${num[4]}<br>${num[5]}<br>${num[6]}<br>${num[7]}<br>${num[8]}<br>

</body>
</html>